export const useLoadData = async (api:any,searchData:any) => {
    const getData = async (paging:any) => {
        const { code, data } = await api({
            ...searchData,
            ...paging
        })
        if (code != 200) return {
            list: [],
            total: 0
        };
        return {
            list: data.list,
            total: data.total
        }
    }
    let paging = {
        page: 1,
        pageSize: 2000 //每次获取数量
    }
    let list:any = []
    let formData: any = await getData(paging)
    list.push(...formData.list)
    if (formData?.total > paging.pageSize) {
        let pageNum = Math.ceil(formData.total / paging.pageSize)
        for (let i = 2; i <= pageNum; i++) {
            let formData: any = await getData(paging)
            list.push(...formData.list)
        }
    }
    return list
}